package com.example.day42_opengl_filter;

import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;

/**
 * Description:继承子GlSurface 运行在GLThread线程中
 * Created by Gdu on 2021/5/1 11:33.
 */

public class CameraView extends GLSurfaceView {

    private CameraRender render;

    public CameraView(Context context) {
        super(context);
    }

    public CameraView(Context context, AttributeSet attrs) {
        super(context, attrs);

        //设置openGL的版本为第二版
        setEGLContextClientVersion(2);
        //初始化渲染器
        render = new CameraRender(this);
        setRenderer(render);
        /**
         * 刷新方式:
         *      GLSurfaceView.RENDERMODE_WHEN_DIRTY  手动刷新,须调用requestRender()
         *      GLSurfaceView.RENDERMODE_CONTINUOUSLY 自动刷新 大概16ms调用一次onDraw
         */
        setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

    }
}
